package com.ego.common.constant;

/**
 * @program: ego
 * @description: 系统常量及枚举
 * @author: KamTang
 * @create: 2022-11-24 10:32
 **/
public class SystemConstant {

    /**
     * 地址中参数连接符号
     */
    public static final String PARAMETER_CONNECTION_SYMBOL = "&";

    /**
     * 参数分割符
     */
    public static final String SPLIT_SYMBOL = "_";

    /**
     * 前端未编码的符号
     */
    public static final String UNENCRYPTED_SYMBOL = "+";

    /**
     * （cookie）域名
     */
    public static final String COOKIE_DOMAIN_NAME = "egomall.shop";

    /**
     * CookieName
     */
    public static final String COOKIE_NAME = "EGOSESSION";

    /**
     * 系统用户类型
     */
    public enum UserEnum {
        /**
         * 超级管理员ID
         */
        SUPER_ADMIN(1, "超级管理员");

        private final int code;
        private final String msg;

        UserEnum(int code, String msg) {
            this.code = code;
            this.msg = msg;
        }
        public int getCode() {
            return code;
        }

        public String getMsg() {
            return msg;
        }
    }

    /**
     * 系统菜单类型
     */
    public enum MenuType {
        /**
         * 目录
         */
        CATALOG(0),
        /**
         * 菜单
         */
        MENU(1),
        /**
         * 按钮
         */
        BUTTON(2),
        /**
         * 系统菜单
         */
        SYS_MENU(31);

        private final int code;

        MenuType(int code) {
            this.code = code;
        }

        public int getCode() {
            return code;
        }
    }

    /**
     * 系统状态码
     */
    public enum Status {
        /**
         * 自定义异常
         */
        SUCCESS(200, "操作成功"),
        UNKNOWN_EXCEPTION(10000, "系统未知异常"),
        VALID_EXCEPTION(10001, "参数格式校验异常"),
        SMS_CODE_EXCEPTION(10002, "验证码获取频率太高，请稍后再试"),
        ACCOUNT_PASSWORD_INVALID(10003, "账户或密码错误"),
        USERNAME_ALWAYS_EXISTS(10004, "用户名已存在"),
        PHONE_REGISTERED(10005, "该号码已被注册"),
        FEIGN_EXCEPTION(10060, "远程服务调用失败"),
        COUPON_FEIGN_EXCEPTION(30063, "优惠远程服务调用失败"),
        COUPON_EXCEPTION(30060, "活动商品无法更新数量"),
        WARE_EXCEPTION(70000, "操作库存服务相关功能出现异常"),
        STOCK_IS_NOT_SUFFICIENT(70001, "库存不足");


        private final int code;
        private final String msg;

        Status(int code, String msg) {
            this.code = code;
            this.msg = msg;
        }

        public int getCode() {
            return code;
        }

        public String getMsg() {
            return msg;
        }
    }

    /**
     * 分类类型
     */
    public enum CategoryType {
        /**
         * 一级分类
         */
        TOP(0L);


        private final long code;

        CategoryType(long code) {
            this.code = code;
        }

        public long getCode() {
            return code;
        }
    }

    /**
     * OSS服务文件上传时文件的contentType
     */
    public enum ContentType {

        /**
         * contentType
         */
        BMP( ".bmp"),
        GIF( ".gif"),
        JPEG( ".jpeg"),
        HTML( ".html"),
        TXT( ".txt"),
        VSD( ".vsd"),
        PPTX( ".pptx"),
        DOCX( ".docx"),
        XML( ".xml");

        private final String msg;

        ContentType(String msg) {
            this.msg = msg;
        }

        public String getMsg() {
            return msg;
        }
    }

}
